<?
require_once("class_GenericRowInt.php");

/********************************************************************************************************/
/* This class represents one row from any table which hase non composit not autoincremented PRIMARY KEY */
/********************************************************************************************************/

class IndexToastName extends GenericRowInt {

    public function IndexToastName($in_id=false) {
	parent::__construct('index_toast_name','tn_id',$in_id);
    }

    public function get_stat($time_id,$prod_sql) {
	$prod_sql->select_c("SELECT
pg_relation_size(oid) AS indexsize,
pg_stat_get_numscans(oid) AS idx_scan,
pg_stat_get_tuples_returned(oid) AS idx_tup_read,
pg_stat_get_tuples_fetched(oid) AS idx_tup_fetch,
pg_stat_get_blocks_fetched(oid) AS idx_blks_fetch,
pg_stat_get_blocks_hit(oid) AS idx_blks_hit
FROM pg_class WHERE oid=".$this->get_field('obj_oid'));
	$idx_stat_res=$prod_sql->get_row_hash();

	$this->sql->non_select_c("INSERT INTO index_toast_stat VALUES (
".$this->id.",
".$time_id.",
".$idx_stat_res['idx_scan'].",
".$idx_stat_res['idx_tup_read'].",
".$idx_stat_res['idx_tup_fetch'].",
".$idx_stat_res['idx_blks_fetch'].",
".$idx_stat_res['idx_blks_hit'].")");
    }

    public function __toString() {
	return $this->get_field('idx_name');
    }
}

?>
